package config

/*const (
	USERNAME = ""
	PASSWORD = ""
	NETWORK = "tcp"
	SERVER = ""
	PORT = 3306
	DATABASE = "demo"

	MAX_LIFE_TIME = time.Second * 100
	MAX_CONNS_NUMBER = 100
	INIT_CONNS_NUMBER = 10
)


func setDB() *sql.DB{
	log.Println("db init...")
	dsn := fmt.Sprintf("%s:%s@%s(%s:%d)/%s",USERNAME,PASSWORD,NETWORK,SERVER,PORT,DATABASE)
	log.Println("dsn=",dsn)
	DB,err := sql.Open("mysql",dsn)
	if err != nil{
		log.Print("open mysql failed,err = ",err)
	}
	// 最大连接时间，超过就断开
	DB.SetConnMaxLifetime(MAX_LIFE_TIME)
	// 最大连接数量
	DB.SetMaxOpenConns(MAX_CONNS_NUMBER)
	// 初始化连接数
	DB.SetMaxIdleConns(INIT_CONNS_NUMBER)

	return DB
}*/
/*//models
type User struct {
	email   string         `db:"email"`
	password string `db:"password"`

}*/